<template>
	<view class="container">
		<view class="padding-sm" v-for="item in list">
			<view class="text-999 text-11 text-center" style="margin-bottom: 20rpx;">
				{{item.createTime}}
			</view>
			<view class="flex justify-start">
				<image :src="baseUrl + '/static/notice2.png'" mode="" class="cu-avatar round"></image>
				<view class="bg-white padding-sm margin-left-sm item">
					<view class="text-15 text-181818">
						{{item.title}}
					</view>
					<view class="text-13 text-666 margin-top-xs padding-bottom-sm solid-bottom">
						{{item.content}}
					</view>
					<!-- <view class="flex justify-between align-center padding-top-sm">
						<view class="text-767696 text-13">
							点击查看
						</view>
						<view class="cuIcon-right">
							
						</view>
					</view> -->
				</view>
			</view>
		</view>
		<uni-load-more :status="loading" />
	</view>
</template>

<script>
	import BetterPull from '@/common/util/BetterPull'
	export default {
		mixins: [
			BetterPull({
				async getPage(page, done) {
					this.loading = 'loading';

					const obj = {
						pageNum: page,
						pageSize: 10,
						userId: uni.getStorageSync('userId'),
						type: this.type

					}
					const [err, res] = await this.$get(this.$api.newlist,
						obj)
					if (res) {
						var data = res.data.list
						done(data);
						if (data.length < 10) {
							this.loading = 'noMore';
						} else {
							this.loading = 'more';
						}

					}
					if (err) {
						done([]);
						this.loading = 'noMore';
					}
				}
			})
		],
		onLoad(option) {
			this.type = option.type
			if (this.type == 1) {
				uni.setNavigationBarTitle({
					title: "系统消息"
				})
			} else if (this.type == 2) {
				uni.setNavigationBarTitle({
					title: "订单消息"
				})
			} else if (this.type == 3) {
				uni.setNavigationBarTitle({
					title: "订单评价"
				})
			} else if (this.type == 4) {
				uni.setNavigationBarTitle({
					title: "我的关注"
				})
			} else {
				uni.setNavigationBarTitle({
					title: "我的投诉"
				})
			}
		},
		data() {
			return {
				baseUrl: this.$config.baseUrl,
				type: '',
				loading: 'more',
			};
		}
	}
</script>

<style lang="scss" scoped>
	.item {
		width: 510rpx;
	}
</style>
